import request from "@/utils/request";

/**
 *获取员工列表
 */
export const getEmployeeListApi = (qurey) => {
  return request({
    method: "GET",
    url: "/sys/user",
    params: qurey,
  });
};

/**
 * 删除员工
 */
export const deleteEmployeeApi = (id) => {
  return request({
    method: "DELETE",
    url: `/sys/user/${id}`,
  });
};

/**
 * 新增员工(单个)
 */
export const addEmployeeApi = (data) => {
  return request({
    method: "POST",
    url: "/sys/user",
    data,
  });
};

/**
 *新增员工(多个)
 */
export const addsEmployeesApi = (data) => {
  return request({
    method: "POST",
    url: "/sys/user/batch",
    data,
  });
};
/**
 * 员工基本信息
 */

export const detailEmployeeApi = (id) => {
  return request({
    method: "GET",
    url: `/sys/user/${id}`,
  });
};

/**
 * 修改员工信息
 */

export const updatedDetailEmployeeApi = (qurey) => {
  return request({
    method: "PUT",
    url: `/sys/user/${qurey.id}`,
    data: qurey,
  });
};

/**
 * 获取员工个人信息
 */
export const PersonalEmployeeApi = (id) => {
  return request({
    method: "GET",
    url: `/employees/${id}/personalInfo`,
  });
};
/**
 * 获取员工岗位信息
 */
export const JobInformationApi = (id) => {
  return request({
    method: "GET",
    url: `/employees/${id}/jobs`,
  });
};
/**
 * 分配员工角色
 */
export const assignmentEmployeeApi = (data) => {
  return request({
    method: "PUT",
    url: "/sys/user/assignRoles",
    data,
  });
};
